package org.nepu.scr.indexrate.converter.compliancerate.operationreliability;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.compliancerate.operationreliability.InstrumentA115;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class InstrumentA115Converter implements AttributeConverter<InstrumentA115, String> {
    @Override
    public String convertToDatabaseColumn(InstrumentA115 instrumentA115) {
        return JSONUtil.toJsonStr(instrumentA115);
    }

    @Override
    public InstrumentA115 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, InstrumentA115.class);
    }
}
